﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using IHISCETeim.BLL;
using IHISCETeim.Library;
using IHISCETeim.Model;
using System.Data;
using System.Text;


namespace IHISCETeim.Web.MachineSys.FXModel
{
    public partial class ReportGetRZFXBP : PageBase
    {
        protected override Permission[] PowerKey
        {
            get
            {
                return new Permission[] { Permission.查看 };
            }
        }
        protected override string DWZRef
        {
            get
            {
                return "ReportGetRZFXBP";
            }
        }

        protected string LeaseCompany
        {
            get
            {
                return GetRequestValue<string>("LeaseCompany", "");
            }
        }
        protected string AliasName
        {
            get
            {
                return GetRequestValue<string>("AliasName", "");
            }
        }
        protected DataTableCollection dts = null;
        protected void Page_Load(object sender, EventArgs e)
        {
            dts = FXFinanceLeaseController.ReportGetRZFXBP(AliasName, LeaseCompany);

        }
        /// <summary>
        /// 所有的客户信息
        /// </summary>
        protected DataRow dt1
        {
            get
            {
                return dts[0].Rows[0];
            }
        }
        /// <summary>
        /// 6期内的新客户
        /// </summary>
        protected DataRow dt2
        {
            get
            {
                return dts[1].Rows[0]; ;
            }
        }

        protected object GetPer(object 逾期总金额, object 剩余总租金)
        {
            //逾期总金额 /剩余总租金

            if (Convert.ToDecimal(逾期总金额) == 0)
                return 0;

            return ((Convert.ToDecimal(逾期总金额) / Convert.ToDecimal(剩余总租金)) * 100).ToString("F2");

        }


        protected string GetAliasNameList()
        {
            DataTable aNList = FXFinanceLeaseController.GetAliasNameLastYear(LeaseCompany);
            StringBuilder sb = new StringBuilder();
            sb.AppendFormat("<option value='{0}' {2}>{1}</option>", "","请选择...","" == AliasName ? "selected" : "");
            foreach (DataRow dr in aNList.Rows)
            {
                sb.AppendFormat("<option value='{0}' {1}>{0}</option>", dr["AliasName"], dr["AliasName"].ToString() == AliasName?"selected":"");
            }

            return sb.ToString();
        }
    }
}